package com.opennews.openplatform.controller;

import com.opennews.openplatform.myspringbootcore.dto.ApiResponse;
import com.opennews.openplatform.myspringbootmvccore.helper.HttpResponseHelper;
import com.opennews.openplatform.service.RegionService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RequiredArgsConstructor
@RestController
@RequestMapping("/region")
public class RegionController {
    private final RegionService regionService;
    private final HttpResponseHelper httpResponseHelper;

    @GetMapping("/query-all")
    public ResponseEntity<ApiResponse<List<Map<String, Object>>>> queryAll() {
        List<Map<String, Object>> result = regionService.queryAll();

        return httpResponseHelper.getSuccessResponse(result);
    }
}
